<!-- 地图找房 -->
<template lang="html">
  <div id="houseMap-container" :class="{fullScreen: this.lat === ''}">
  </div>
</template>

<script>
import TXMap from '@/util/TXMap'
export default {
  props: {
    lat: {
      type: String,
      default: ''
    },
    lng: {
      type: String,
      default: ''
    }
  },
  mounted () {
    let lat = this.lat || this.$route.query.lat || '22.702'
    let lng = this.lng || this.$route.query.lng || '114.09'
    let draggable = this.lng === ''
    TXMap.drawHouseLocation({
      containerId: 'houseMap-container',
      draggable,
      lat,
      lng
    })
  },
  beforeDestroy () {
    TXMap.clearMap()
  }
}
</script>

<style lang="less">
  #houseMap-container{
    width: 100%;
    height: 100%;
    &.fullScreen{
      height: 100vh;
    }
  }
</style>
